<script lang="ts">
import { defineComponent, onMounted, onBeforeUnmount } from "vue";
import { TronLinkAdapter } from "@tronweb3/tronwallet-adapters";
export default defineComponent({
    setup() {
        const adapter = new TronLinkAdapter();
        onMounted(function () {
            adapter.on("connect", (data) => {
                console.log("33333333333333333", data);
                // here you can do something
            });
        });
        onBeforeUnmount(function () {
            // remove all listeners when components is destroyed
            adapter.removeAllListeners();
        });
        const chadapter = async () => {
            const adapter = new TronLinkAdapter();
            try {
                const datas = await adapter.connect();
                console.log(datas);
            } catch (e: any) {
                console.log(e);
            }
        };
        return {
            chadapter,
        };
    },
});
</script>

<template>
    <div class="t1">
        <div @click="chadapter" class="da">fesfe</div>
    </div>
</template>

<style lang="less" scoped>
.t1 {
    z-index: 9999;
    padding-top: 100px;
}
.da {
    padding: 30px;
}
</style>
